<template>
	<view>
		<image src="../../../static/me/bg1.jpg" mode="" style="position: fixed;top: 0; left: 0;width: 100vw; height: 100vh;"></image>
		<view style="z-index: 100;position: absolute;width: 100vw;padding-left: 5px;">
			<view class="text-center" v-if="addressDetail">
				<text style="font-size: 15px; color: #8a8a8a;">{{addressDetail + "的送水记录"}}</text>
			</view>
			<view v-for="(item, index) in taskLogs" v-bind:key="item.id" style="padding: 10rpx">
				<view style="border-top: 1px solid #bcc0c6;" >
					<view>水票价格 {{item.waterPrice}}</view>
					<view>收到水桶 {{item.bucketNum}}</view>
					<view>
						<text v-if="item.receiveEmptyBucketNum <= 0" style="color: red;">收回空桶 {{item.receiveEmptyBucketNum}}</text>
						<text v-else>收回空桶 {{item.receiveEmptyBucketNum}}</text>
					</view>
					</view>
					<view>叫水人 {{item.publisher }}</view>
					<view>送水员 {{item.workerName}}</view>
					<view>送水时间 {{item.timestamp}}</view>
				</view>
			</view>		
		</view>
	</view>
</template>

<script>
// 寝室送水记录
export default {
	data() {
		return {
			taskLogs: [],
			addressDetail: null
		};
	},
	// data: {addressId} // utl: "xxx?addressId=xxx"传入数据
	onLoad(data) { 
		console.log("寝室叫水记录页面", data)
		this.addressId = data.addressId;
		if(data.addressId)
			this.getHistoryLog(data.addressId);
	},
	methods: {
		getHistoryLog(addressId) {
			let that = this;
			that.$request('/taskLog/address/' + addressId, 'get').then(result => {
				that.taskLogs = result.data;
				if(result.data && result.data[0]){
					let taskLog = result.data[0];
					that.addressDetail = taskLog.dorm + taskLog.room;
				}
			});
		},
	}
};
</script>

